<table width="100%" border="0" cellpadding="0" cellspacing="0" background="/images/mainpage-sliced_16.jpg">
  <tr>
    <td width="20" height="40">&nbsp;</td>
    <td class="style5" style="border-right:solid 1px #FFFFFF;">Assign Resource Cost</td>
  </tr>
</table>

<table>
  <thead>
    <tr class= "style2" background="/images/mainpage-sliced_11.jpg">
      <th id="sf_admin_list_batch_actions" align="left"><input id="sf_admin_list_batch_checkbox" type="checkbox" onclick="checkAll();" /></th>
      <th>Name</th>
      <th>Cost</th>
    </tr>
  </thead>
  <tbody>
  <form action="updatecost" method="post" name="form1">    
    <?php foreach ($resources as $i => $resource): ?>
    <tr class="regulartext_<?php echo fmod($i, 2) ? 'even' : 'odd' ?>">
      <td>
        <input type="checkbox" name="ids[]" value="<?php echo $resource->getResourceid() ?>" class="sf_admin_batch_checkbox" onclick="document.getElementById(<?php echo $resource->getResourceid() ?>).disabled=(this.checked)?0:1" />
      </td>
      <td><?php echo $resource->getName() ?></td>
      <td>
        <input type="text" id="<?php echo $resource->getResourceid() ?>" name="rates[]" value="<?php echo $resource->getRate() ?>" class="sf_admin_batch_checkbox" disabled=true/>
	  </td>      
    </tr>
    <?php endforeach; ?>
    <tr>
      <td colspan="3"><input type="submit" value="Update" /></td>

    </tr>    
  </form>
  </tbody>
</table>
<script type="text/javascript">
/* <![CDATA[ */
function checkAll()
{
  var boxes = document.getElementsByTagName('input'); 

  for(var index = 1; index < boxes.length; index++) { 
    box = boxes[index]; 

    if (box!= null && box.type == 'checkbox' && box.className == 'sf_admin_batch_checkbox') {
	   box.checked = document.getElementById('sf_admin_list_batch_checkbox').checked;
	   if(box.checked) {
 	     document.getElementById(box.value).disabled=false;
	   } else {
	     document.getElementById(box.value).disabled=true;
	   }
	 } 
	} 
  return true;
}
/* ]]> */
</script>
